<template>
  <BasicDialog ref="basicDialog" :isVisible="isAlert" width="50%" :title="'查看'" :isShowSure="false">
    <template #content>
      <el-form ref="formRef" :model="formInfo"  label-width="120px">
        <el-form-item label="日志id：" >          
          <span >{{ formInfo.jobLogId }}</span>
        </el-form-item>
        <el-form-item label="任务名称" >
          <span >{{ formInfo.jobName }}</span>
        </el-form-item>
        <el-form-item label="任务组名" >
          <span >{{ formInfo.jobGroup }}</span>
        </el-form-item>
        <el-form-item label="任务类" >
          <span >{{ formInfo.jobClassName }}</span>
        </el-form-item>
        <el-form-item label="任务参数" >
          <span >{{ formInfo.parameter }}</span>
        </el-form-item>
        <el-form-item label="执行状态" >
          <span >{{ commonStateEnum[formInfo.status] }}</span>
        </el-form-item>
        <el-form-item label="异常信息" >
          <span >{{ formInfo.exceptionInfo }}</span>
        </el-form-item>
        <el-form-item label="执行时间" >
          <span >{{ formInfo.createTime }}</span>
        </el-form-item>
        <el-form-item label="执行时长(秒)" >
          <span >{{ formInfo.duration }}</span>
        </el-form-item>
      </el-form>
    </template>
  </BasicDialog>
</template>
<script lang='ts' setup>
import { FormInfo } from "@components/common/BasicForm/BasicFormTypes";
import type { FormRules, FormInstance } from 'element-plus';
import { getJobLogById } from "@/request/apis/job/jobLog"
import { commonStateEnum } from "@/utils/staticData";
const props = defineProps({
  info: {
    type: Object,
    default: () => {
      return {}
    }
  },
  isAlert: {
    type: Boolean,
    default: false
  },
})

const $emits = defineEmits([
  "closeDialog"
])

// 提交表单校验
const formRef = ref<FormInstance>();
const basicDialog = ref();

//表单数据 
let formInfo = ref<FormInfo>({});

onMounted(async () => {
  formInfo.value = await getJobLogById(props.info.jobLogId)
})

</script>

<style scoped lang="scss"></style>